using System.Collections.Generic;
using Terra.Core.Common.ErrorCodes.Models;

namespace Terra.Core.Common.ErrorCodes.Providers;

/// <summary>
/// 错误码提供者接口
/// </summary>
public interface IErrorCodeProvider
{
    /// <summary>
    /// 获取错误码信息
    /// </summary>
    /// <param name="code">错误码</param>
    /// <returns>错误码信息</returns>
    ErrorCodeInfo GetErrorInfo(string code);

    /// <summary>
    /// 注册错误码
    /// </summary>
    /// <param name="code">错误码</param>
    /// <param name="info">错误码信息</param>
    void RegisterErrorCode(string code, ErrorCodeInfo info);

    /// <summary>
    /// 检查错误码是否存在
    /// </summary>
    /// <param name="code">错误码</param>
    /// <returns>是否存在</returns>
    bool Exists(string code);

    /// <summary>
    /// 获取所有错误码信息
    /// </summary>
    /// <returns>错误码信息列表</returns>
    IReadOnlyDictionary<string, ErrorCodeInfo> GetAllErrorCodes();
}